<%--
    Верхний заголовок, включается на все страницы клиентской части приложения.
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" %>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>

<f:subview id="clientHeader">

    <h:panelGroup styleClass="preheader" layout="block">
        <a4j:commandLink value="Как заказать?"/>
        <a4j:commandLink value="О доставке"/>
        <a4j:commandLink value="Помощь"/>
    </h:panelGroup>

    <%-- -------------- Фасад -------------- --%>
    <rich:toolBar height="50" id="goodsInOrder">
        <rich:toolBarGroup>
            <h:panelGroup>
                <a4j:commandLink onclick="document.location='ClientGoodsPage.jsf'">
                    <h:outputText value="Zip1001" styleClass="hdr_0" style="text-decoration:none"/>
                </a4j:commandLink><br>
                <h:outputText value="Товары для авто. Доставка по России."/>
                <h:outputLink value="mailto:info@goodfil.com" styleClass="hdr_1">info@goodfil.com</h:outputLink>
            </h:panelGroup>
        </rich:toolBarGroup>
        <rich:toolBarGroup>
            <h:panelGroup>
                <%--<h:outputText value="Заказ по телефонам" styleClass="hdr_2"/><br>--%>
                <%--<h:outputText value="(495) 111-22-33" styleClass="hdr_3"/><br>--%>
                <%--<h:outputText value="(495) 111-22-34" styleClass="hdr_3"/><br>--%>
                <%--<h:outputText value="Доставка по России. Только для юридических лиц" styleClass="hdr_4"/>--%>
            </h:panelGroup>
        </rich:toolBarGroup>
        <rich:toolBarGroup location="right">

            <h:panelGroup styleClass="pnl1">
                <h:form>
                    <h:panelGroup layout="block" styleClass="pnl2">
                        <h:panelGroup layout="block" styleClass="" rendered="#{SessionBean.clientIsSelected}">
                            <h:outputText value="Вы вошли как: " styleClass="b" style="color:black;"/>
                            <h:outputText value="#{SessionBean.companyName}" style="color:black;"/>
                        </h:panelGroup>
                        <h:panelGrid columns="2" cellpadding="0" cellspacing="0">
                            <h:panelGroup>
                                <a4j:commandLink
                                        action="#"
                                        ajaxSingle="true"
                                        styleClass="order_link"
                                        style="font-size:120%;text-decoration:none"
                                        oncomplete="document.location='ClientOrderItemPage.jsf'">
                                    <h:graphicImage value="/resources/img/shoppingcart_32.gif" width="24"/>
                                </a4j:commandLink>
                            </h:panelGroup>
                            <h:panelGroup>
                                <a4j:commandLink value="Заказ #{SessionBean.order.idAsString}"
                                                 action="#"
                                                 ajaxSingle="true"
                                                 styleClass="order_link"
                                                 style="font-size:120%;text-decoration:none;color:black"
                                                 oncomplete="document.location='ClientOrderItemPage.jsf'"/><br>
                                <h:outputText
                                        value="#{SessionBean.orderItemsCount} наименований (-ия) на сумму #{SessionBean.orderPrice}"/>
                            </h:panelGroup>
                        </h:panelGrid>
                    </h:panelGroup>

                    <h:panelGroup layout="block" styleClass="">
                        <h:panelGrid columns="2" rendered="#{SessionBean.selectedClientId == -1}">
                            <h:panelGroup layout="block" styleClass="client_pane">
                                <a4j:commandLink onclick="document.location='ClientAuthorizationPage.jsf'"
                                                 style="font-size:120%">
                                    <h:graphicImage value="/resources/img/lock.png" styleClass="ico1"/>
                                    <h:outputText value="Вход для клиентов"/>
                                </a4j:commandLink>
                            </h:panelGroup>
                            <h:panelGroup layout="block" styleClass="client_pane">
                                <a4j:commandLink oncomplete="document.location='ClientRegistrationPage.jsf'"
                                                 style="font-size:120%">
                                    <h:graphicImage value="/resources/img/user1.png" styleClass="ico1"/>
                                    <h:outputText value="Регистрация"/>
                                </a4j:commandLink>
                            </h:panelGroup>
                        </h:panelGrid>

                        <h:panelGrid columns="2" rendered="#{SessionBean.clientIsSelected}">

                            <h:panelGroup layout="block" styleClass="client_pane">
                                <a4j:commandLink oncomplete="document.location='ClientRoomPage.jsf'"
                                                 style="font-size:120%"
                                                 id="lRoom">
                                    <h:graphicImage value="/resources/img/house.png" styleClass="ico1"/>
                                    <h:outputText value="Личный кабинет"/>
                                </a4j:commandLink>
                                <rich:toolTip for="lRoom"
                                              value="Перейти в личный кабинет для просмотра истории заказов, персональной информации"/>
                            </h:panelGroup>

                            <h:panelGroup layout="block" styleClass="client_pane">
                                <a4j:commandLink reRender="goodsInOrder" id="lExit"
                                                 action="#{ClientAuthorizationBean.exitClient}"
                                                 oncomplete="document.location='ClientGoodsPage.jsf'"
                                                 style="font-size:120%">
                                    <a4j:actionparam name="client_id" assignTo="#{SessionBean.selectedClientId}"
                                                     value="-1"/>
                                    <a4j:actionparam name="client_id" assignTo="#{SessionBean.selectedOrderId}"
                                                     value="-1"/>
                                    <h:graphicImage value="/resources/img/close_32x32.png" styleClass="ico1"/>
                                    <h:outputText value="Выход"/>
                                </a4j:commandLink>
                                <rich:toolTip for="lExit" value="Закончить работу в системой"/>
                            </h:panelGroup>
                        </h:panelGrid>

                    </h:panelGroup>
                </h:form>
            </h:panelGroup>
        </rich:toolBarGroup>
    </rich:toolBar>
    <rich:separator style="padding:0;margin:0"/>

    <!-- Ссылки -->
    <h:panelGroup rendered="#{SettingsBean.isClientPreheaderShouldBeRendered}">
        <h:panelGroup layout="block" styleClass="preheader" style="text-align:center;">
            <%--Сайт Goodwill--%>
            <h:outputLink value="#{SettingsBean.settingsMap['public.goodwill.site.link']}">
                <h:outputText value="#{SettingsBean.settingsMap['public.goodwill.site.name']}"/>
            </h:outputLink>
            <%--Каталог он-лайн Goodwill--%>
            <h:outputLink value="#{SettingsBean.settingsMap['public.goodwill.catalog.link']}">
                <h:outputText value="#{SettingsBean.settingsMap['public.goodwill.catalog.name']}"/>
            </h:outputLink>
            <%--Условия сотрудничества--%>
            <h:outputLink value="#{SettingsBean.settingsMap['public.goodwill.doc.link']}">
                <h:outputText value="#{SettingsBean.settingsMap['public.goodwill.doc.name']}"/>
            </h:outputLink>
        </h:panelGroup>
    </h:panelGroup>
</f:subview>